import axios from '@/utils/request.js'


// 获取文章分类
export const getArticleCate = () => {
        return axios({
                url: '/my/cate/list',
        })
}
// 添加文章分类
export const addArticleCate = (data) => {
        return axios({
                url: '/my/cate/add',
                method: 'post',
                data
        })
}
// 编辑文章分类
export const editArticleCate = (data) => {
        return axios({
                url: '/my/cate/info',
                method: 'put',
                data
        })
}
// 删除文章分类
export const delArticleCate = (id) => {
        return axios({
                url: '/my/cate/del',
                method: 'delete',
                params: {id}
        })
}

// 获取文章管理列表
export const getArticleList = (params) => {
        return axios({
                url: '/my/article/list',
                params
        })
}
// 发布文章
//这里的data是一个formData格式的对象，传参之前要将普通的js对象转成formData对象
export const pubArticle = (data) => {
        return axios({
                url: '/my/article/add',
                method: 'post',
                data
        })
}
// 文章详情
export const detailArticle = (params) => {
        return axios({
                url: '/my/article/info',
                params
        })
}
// 编辑文章
export const editArticle = (data) => {
        return axios({
                url: '/my/article/info',
                method: 'put',
                data
        })
}
// 删除文章
export const delArticle = (id) => {
        return axios({
                url: '/my/article/info',
                method: 'delete',
                params: {id}
        })
}
